package com.shop.pojo;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.beans.BeanUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

/**
 * <p>
 * 商品表 商品信息相关表：分类表，商品图片表，商品规格表，商品参数表
 * </p>
 *
 * @author Administrator
 * @since 2020-10-31
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("items")
public class Items implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 商品主键id
     */
    @TableId(value = ID, type = IdType.INPUT)
    private String id;

    /**
     * 商品名称 商品名称
     */
    @TableField(ITEM_NAME)
    private String itemName;

    /**
     * 分类外键id 分类id
     */
    @TableField(CAT_ID)
    private String catId;

    /**
     * 一级分类外键id
     */
    @TableField(ROOT_CAT_ID)
    private String rootCatId;

    /**
     * 累计销售 累计销售
     */
    @TableField(SELL_COUNTS)
    private Integer sellCounts;

    /**
     * 上下架状态 上下架状态,1:上架 2:下架
     */
    @TableField(ON_OFF_STATUS)
    private Integer onOffStatus;

    /**
     * 商品内容 商品内容
     */
    @TableField(CONTENT)
    private String content;

    /**
     * 创建时间
     */
    @TableField(CREATED_TIME)
    private Date createdTime;

    /**
     * 更新时间
     */
    @TableField(UPDATED_TIME)
    private Date updatedTime;


    public static final String ID = "`id`";

    public static final String ITEM_NAME = "`item_name`";

    public static final String CAT_ID = "`cat_id`";

    public static final String ROOT_CAT_ID = "`root_cat_id`";

    public static final String SELL_COUNTS = "`sell_counts`";

    public static final String ON_OFF_STATUS = "`on_off_status`";

    public static final String CONTENT = "`content`";

    public static final String CREATED_TIME = "`created_time`";

    public static final String UPDATED_TIME = "`updated_time`";


    public static final String ID_COMMENT = "商品主键id";

    public static final String ITEM_NAME_COMMENT = "商品名称 商品名称";

    public static final String CAT_ID_COMMENT = "分类外键id 分类id";

    public static final String ROOT_CAT_ID_COMMENT = "一级分类外键id";

    public static final String SELL_COUNTS_COMMENT = "累计销售 累计销售";

    public static final String ON_OFF_STATUS_COMMENT = "上下架状态 上下架状态,1:上架 2:下架";

    public static final String CONTENT_COMMENT = "商品内容 商品内容";

    public static final String CREATED_TIME_COMMENT = "创建时间";

    public static final String UPDATED_TIME_COMMENT = "更新时间";



    public static Items of(Object obj) {
        Items e = new Items();
        BeanUtils.copyProperties(obj, e);
        return e;
    }

    public static QueryWrapper<Items> queryWrapper(Object obj) {
        return new QueryWrapper<>(of(obj));
    }

}
